﻿using System;
using System.Collections;
using System.Collections.Generic;
using UIFrameWork;
using UnityEngine;
using UnityEngine.EventSystems;

public class InputModule : Singleton<InputModule>,IGameModule
{

	public event TouchActions TouchAction;

	public void AddTouchActions(TouchActions touchActions)
	{
		this.TouchAction = (TouchActions) Delegate.Combine(this.TouchAction, touchActions);
	}

	public void RemoveTouchActions(TouchActions touchActions)
	{
		this.TouchAction = (TouchActions) Delegate.Remove(this.TouchAction, touchActions);
	}
	public void UpdateFrame()
	{
		
	}

	private void CheckTouchState()
	{
		if (EventSystem.current && EventSystem.current.IsPointerOverGameObject())
		{
			return;
		}
		if (this.TouchAction != null)
		{
			for (int i = 0; i < Input.touchCount; i++)
			{
				this.TouchAction(this,new TouchEventArgs(Input.GetTouch(i),i));
			}
		}
	}
}
